package com.qidian.buy.search.receive;

import com.qidian.buy.search.service.SearchService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author 戴着假发的程序员
 * @Company 起点编程
 * @date 2023/5/25 13:56
 */
@Component
public class ItemAddRevice {

    @Autowired
    private SearchService searchService;
    @RabbitListener(queues="item-search-queue")
    public void syncSearch(long itemId){
        // 接收消息之后，调用service添加索引即可
        searchService.addIndex(itemId);
    }
}
